package com.caojing.syby.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;

/**
 * Created by caojing
 */
/*basefragment,继承这个类得类如果不是抽象类就得实现其中得三个抽象方法*/

public abstract class BaseFragment extends Fragment implements IBaseView{
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(getLayoutId(),null);
        ButterKnife.bind(this, view);
        initView(view);
        initData();
        return view;
    }
    protected abstract int getLayoutId();

    protected abstract void initView(View view);

    protected abstract void initData();

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
